home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / earcd / misc / emu / arosdev.lha / AROS / scripts / stat.awk < prev   
Text File  |  1997-02-03  |  1KB  |  60 lines

  1. BEGIN {
  2.     file=ENVIRON["HOME"] "/Mail/jobs";
  3.  
  4.     while ((getline < file) > 0)
  5.     {
  6.     if (match($0,/^[a-zA-Z_/.]+[0-9]+ (WORK|DONE|FREE)/))
  7.     {
  8.         match($0,/^[a-zA-Z_/.]+/);
  9.         name=substr($0,RSTART,RLENGTH);
  10.         job[name]++;
  11.         jobs ++;
  12.         if ($2 == "WORK")
  13.         {
  14.         jobw[name]++;
  15.         work ++;
  16.         }
  17.         else if ($2 == "DONE")
  18.         {
  19.         jobd[name]++;
  20.         done ++;
  21.         }
  22.         else
  23.         {
  24.         jobf[name]++;
  25.         free ++;
  26.         }
  27.     }
  28.     if (match($0,/^[a-zA-Z_/.]+ (WORK|DONE|FREE)/))
  29.     {
  30.         ojobs ++;
  31.         if ($2 == "WORK") owork ++;
  32.         else if ($2 == "DONE") odone ++;
  33.         else ofree ++;
  34.     }
  35.     }
  36.  
  37.     close (file);
  38.  
  39.     print "There is a total of " jobs " functions."
  40.     printf ("%4d (%7.2f%%) are still todo\n",        free, free*100.0/jobs);
  41.     printf ("%4d (%7.2f%%) are currently in work\n", work, work*100.0/jobs);
  42.     printf ("%4d (%7.2f%%) are completed\n",         done, done*100.0/jobs);
  43.     print ""
  44.     for (name in job)
  45.     {
  46.     printf ("%4d jobs in %s (%.2f%% todo, %.2f%% in work, %.2f%% completed\n",
  47.         job[name],
  48.         name,
  49.         jobf[name]*100.0/job[name],
  50.         jobw[name]*100.0/job[name],
  51.         jobd[name]*100.0/job[name]);
  52.     }
  53.     print ""
  54.     print "There is a total of " ojobs " other things."
  55.     printf ("%4d (%7.2f%%) are still todo\n",        ofree, ofree*100.0/ojobs);
  56.     printf ("%4d (%7.2f%%) are currently in work\n", owork, owork*100.0/ojobs);
  57.     printf ("%4d (%7.2f%%) are completed\n",         odone, odone*100.0/ojobs);
  58. }
  59.  
  60.